<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>后台管理</title>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/layui/css/layui.css" />
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/admin.css" />
</head>

<body>
<div class="page-content-wrap">
  <form class="layui-form" action="">
    <div class="layui-form-item">
      <div class="layui-inline tool-btn">
        <button class="layui-btn layui-btn-small layui-btn-normal addBtn hidden-xs" data-url="{:url('add')}"><i class="layui-icon">&#xe654;</i></button>
        <button class="layui-btn layui-btn-small layui-btn-warm listOrderBtn hidden-xs" data-url="{:url('sort')}"><i class="iconfont">&#xe656;</i></button>
      </div>
      <div class="layui-inline">
        <input type="text" name="q" placeholder="请输入标题" autocomplete="off" class="layui-input">
      </div>
      <div class="layui-inline">
        <select name="hide" lay-filter="status">
          <option value="">请选择一个状态</option>
          <option value="0">显示</option>
          <option value="1">隐藏</option>
        </select>
      </div>
      <button class="layui-btn layui-btn-normal" type="submit" lay-submit="search">搜索</button>
    </div>
  </form>
  <div class="layui-form" id="table-list">
  <form class="sort_from">
    <table class="layui-table" lay-skin="line">
      <colgroup>
      <col width="50">
      <col class="hidden-xs" width="50">
      <col class="hidden-xs" width="100">
      
      <col>
      <col width="80">
      <col width="130">
      </colgroup>
      <thead>
        <tr>
          <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
          <th class="hidden-xs">ID</th>
          <th class="hidden-xs">排序</th>
          
          <th>菜单名称</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        
        {volist name='_list' id='vo'}
        <tr id='node-{$vo.id}' class="parent collapsed">
          <td><input type="checkbox" name="" lay-skin="primary" data-id="{$vo.id}"></td>
          <td class="hidden-xs">{$vo.id}</td>
          <td class="hidden-xs"><input type="hidden" name="ids[]" value="{$vo.id}"><input type="text" name="sort[]" autocomplete="off" class="layui-input" value="{$vo.sort}" data-id="{$vo.id}"></td>
          
          <td>
          {$vo.title} 
          </td>
          <td><button class="layui-btn layui-btn-mini {if condition="$vo['hide'] eq 0"}layui-btn-normal{else/}layui-btn-warm{/if} table-list-status" data-status="{$vo.hide}" data-id="{$vo.id}">{if condition="$vo['hide'] eq 0"}显示{else/}隐藏{/if} </button></td>
          <td><div class="layui-inline">
              
              <button class="layui-btn layui-btn-mini layui-btn-normal  edit-btn" data-id="{$vo.id}" data-url="{:url('edit',array('id'=>$vo['id']))}"><i class="layui-icon">编辑</i></button>
              <button class="layui-btn layui-btn-mini layui-btn-danger del-btn" data-id="{$vo.id}" data-url="{:url('del',array('id'=>$vo['id']))}"><i class="layui-icon">删除</i></button>
            </div></td>
        </tr>
        
        
        
        {/volist}
        
        
      </tbody>
    </table>
    </form>
	<div class="page-wrap">
      {$_page}
      </div>
  </div>
</div>
<script type="text/javascript">
	var module_path = "__STATIC__/admin/js/module/";
</script>
<script src="__STATIC__/js/jquery.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="__STATIC__/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script> 
<script src="__STATIC__/admin/js/common.js" type="text/javascript" charset="utf-8"></script> 
<script src="__STATIC__/js/common.js" type="text/javascript" charset="utf-8"></script> 
<script>
			layui.use(['jquery'], function() {
				var $=layui.jquery;
				//修改状态
				$('#table-list').on('click', '.table-list-status', function() {
					var That = $(this); 
					var status = That.attr('data-status');
					var id = That.attr('data-id');
					var url = conv_url("{:url('status')}")+"id="+id;
					
					if(status == 0) {
						That.removeClass('layui-btn-normal').addClass('layui-btn-warm').html('隐藏').attr('data-status', 1);
						url += "&hide="+1;
					} else if(status == 1) {
						That.removeClass('layui-btn-warm').addClass('layui-btn-normal').html('显示').attr('data-status', 0);
						url += "&hide="+0;
					}
					get_data(url,false);
					return false;
				})
				//栏目展示隐藏
				$('.showSubBtn').on('click', function() {
					var _this = $(this);
					var id = _this.attr('data-id');
					var parent = _this.parents('.parent');
					var child = $('.child-node-' + id);
					var childAll = $('tr[parentid=' + id + ']');
					if(parent.hasClass('collapsed')) {
						_this.html('-');
						parent.addClass('expanded').removeClass('collapsed');
						child.css('display', '');
					} else {
						_this.html('+');
						parent.addClass('collapsed').removeClass('expanded');
						child.css('display', 'none');
						childAll.addClass('collapsed').removeClass('expanded').css('display', 'none');
						childAll.find('.showSubBtn').html('+');
					}

				})
				
				
			});
		</script>
</body>
</html>